import requests
import json
import random

useragent = [
    'Mozilla/5.0(Macintosh;U;IntelMacOSX10_6_8;en-us)AppleWebKit/534.50(KHTML,likeGecko)Version/5.1Safari/534.50'
]
url = 'https://box.maoyan.com/promovie/api/box/second.json?beginDate=20180806'


def get_user_agent():
    headers = {
        'User-Agent': random.choice(useragent)}
    return headers


html = requests.get(url=url, headers=get_user_agent())
result = json.loads(html.text)
for dy in result['data']['list']:
    print(dy)
'''
  'showInfo': 拍片场次
  'boxRate': 票房占比
  'avgShowView': 场均人次
  'seatRate': 
  'movieId': 1198178,
  'avgSeatView': 上座率
  'refundViewRate': 
  'releaseInfoColor': '#666666 1.00',
  'boxInfo': 综合票房
  'viewInfoV2': 
  'splitAvgViewBox': '32.5',
  'movieName': 电影名称
  'splitSumBoxInfo': '4.76亿',
  'refundViewInfo': '1',
  'releaseInfo': 上映时间
  'sumBoxInfo': 总票房
  'splitBoxRate': 票房占比
  'splitBoxInfo': '1.24',
  'viewInfo': '0.0',
  'showRate': 排片占比
  'avgViewBox': '35.2',
  'myRefundRateInfo': '<0.1%',
  'myRefundNumInfo': '0',
  'onlineBoxRate': '88.9%'
'''
